package top.zuli.package03.exam01;

public interface Hero3 {
    public void buyHero();
    public void userHero();

    public static void main(String[] args) {
        Hero3 hero3 = HeroFactory3.getHero("马克");
        hero3.buyHero();
        hero3.userHero();
        Hero3 hero21 = HeroFactory3.getHero("凯");
        hero21.buyHero();
        hero21.userHero();

    }
}
class MaKe implements Hero3{

    @Override
    public void buyHero() {
        System.out.println("13999金币可以购买马克");
    }

    @Override
    public void userHero() {
        System.out.println("攻速型射手");
    }
}
class Kai implements Hero3{

    @Override
    public void buyHero() {
        System.out.println("13999金币可以购买凯");
    }

    @Override
    public void userHero() {
        System.out.println("峡谷凯爹");
    }
}
class HeroFactory3{
    public static Hero3 getHero(String name){
        if (name.equals("马克")){
            return new MaKe();
        }
        if (name.equals("凯")){
            return new Kai();
        }
        return null;
    }
}
